import baseService from '@/utils/http/axios'
import { Basic } from './types'

/**
 * @param params
 */
export const createTemplate: (params: Object) => Promise<Basic> = (params) => {
  const api = `/manage/template`
  return baseService.post(api, params)
}

export const updateTemplate: (params: Object) => Promise<Basic> = (params) => {
  const api = `/manage/template`
  return baseService.put(api, params)
}


export const getTemplate: () => Promise<Basic> = (id) => {
  const api = `/manage/template/${id}`
  return baseService.get(api)
}
export const getTemplateHistory: (bussinessId ,systemId) => Promise<Basic> = (bussinessId ,systemId ) => {
  const api = `/manage/template/getHistory?systemId=${systemId}&bussinessId=${bussinessId}`
  return baseService.get(api)
}
/**
 * {
 * "pageIndex": 1,
 * "pageSize": 10
 * }
 * @param params
 */
export const listTemplate: (params: Object) => Promise<Basic> = (params) => {
  const api = `/manage/template/page`
  return baseService.post(api, params)
}

export const upgradeTemplate: (params: Object) => Promise<Basic> = (params) => {
  const api = `/manage/template/upgrade`
  return baseService.post(api, params)
}


export const uploadTemplate: (params: Object,config) => Promise<Basic> = (params,config) => {
  const api = `/masterPlate/uploadoss`
  return baseService.post(api, params,config)
}

export const deleteTemplate: (id) => Promise<Basic> = (id) => {
  const api = `/manage/template/${id}`
  return baseService.delete(api)
}


export const batchDeleteTemplate: (params) => Promise<Basic> = (params) => {
  const api = `/manage/template/delete`
  return baseService.delete(api,params)
}
